using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace teavch.Utilities.Electrical.Design.Gui.LineDiagram
{
	public partial class Fuse : ElectricalSymbol
  {

		public Fuse()
    {
      InitializeComponent();
			this.SymbolSize = 100;
			this.BorderWidth = 1;
    }

    protected override void OnPaint( PaintEventArgs e )
    {
      base.OnPaint( e );
      this.Paint( e );
    }

    protected override void OnResize( EventArgs e )
    {
      base.OnResize( e );
      ResizeNow( e );
    }

    private void ResizeNow( EventArgs ea )
    {
      this.Refresh();
    }

    private new void Paint( PaintEventArgs pea )
    {
			float _c1x1 = 0, _c1size = 0;

			int _x1 = 0, _x2 = 0;
			_x2 = ( int )( this.SymbolSize * .2 );

			this.Width = this.SymbolSize;
			this.Height = ( int )( this.SymbolSize * .1 ) + 1;
			
			System.Drawing.Drawing2D.GraphicsPath _gpath = new System.Drawing.Drawing2D.GraphicsPath();
			
			_gpath.AddLine( _x1, ( int )( this.Height / 2 ), ( int )( this.SymbolSize * .2 ), ( int )( this.Height / 2 ) );
			_gpath.CloseAllFigures();
			_gpath.AddLine( ( int )( this.SymbolSize * .8 ), ( int )( this.Height / 2 ),  this.SymbolSize , ( int )( this.Height / 2 ) );

			_c1x1 = ( int )( this.SymbolSize * .2 );
			_c1size = ( int )( this.SymbolSize * .6 );

			_gpath.AddArc( _c1x1, 0, _c1size, this.Height-1, 0, 360 );

			pea.Graphics.FillPath( this.Brush, _gpath );
			pea.Graphics.DrawPath( this.Pen, _gpath );
    }

  }
}
